package com.captjack.micro.api.hello;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * restful风格接口设计
 *
 * @author Jack Sparrow
 * @version 1.0.0
 * @date 2018/8/8 22:53
 * package com.captjack.micro.api.hello
 */
@RestController
@RequestMapping(value = "/api/v1/captjack/users")
public interface UserService {

    /**
     * 根据id删除
     *
     * @param id id
     */
    @DeleteMapping(value = "/{id}")
    void deleteById(@PathVariable("id") String id);

    /**
     * 根据id查询
     *
     * @param id id
     */
    @GetMapping(value = "/{id}")
    void findById(@PathVariable("id") String id);

    /**
     * insert一条数据
     *
     * @param user 用户
     */
    @PostMapping
    void add(@RequestParam String user);

    /**
     * 分页查询
     *
     * @param page        分页索引
     * @param pageSize    每页条数
     * @param otherParams 查询参数
     */
    @GetMapping
    void findList(int page, int pageSize, String otherParams);

    /**
     * 更新指定字段
     *
     * @param user 信息
     */
    @PatchMapping
    void patchUpdate(@RequestParam String user);

    /**
     * 全量更新
     *
     * @param user 信息
     */
    @PutMapping
    void updateAll(@RequestParam String user);

}
